import os
import sys

def read_directory(path1, path2):
    print(path1)
    for root, dirs, files in os.walk(path1):
        for file in files:
            full_path = os.path.join(root, file)
            _, extension = os.path.splitext(full_path)
            if extension in ['.php']:
                try:
                    cur = os.path.getsize(full_path)
                    mb_path = full_path.replace(path1, path2)
                    mb = os.path.getsize(mb_path)
                    if cur == mb:
                        #print(cur, mb, full_path)
                        pass
                    else:
                        print(f'\033[91m{cur} {mb} {full_path}\033[0m')
                except Exception as e:
                    print(f'\033[91m {full_path}::{e}\033[0m')

            # return
            # print(f"[{os.path.getsize(full_path)}]--{full_path}\n")


if __name__ == '__main__':
    arg = sys.argv
    # arg = arg[1] if len(arg)>1 else ''
    # path = arg if arg else './'
    path1 = arg[1] if len(arg)>1 else ''
    path2 = arg[2] if len(arg)>2 else ''

    read_directory(path1, path2)
